/*****************************************************************************/
/**
 *  @file   main.cpp
 *  @author Naohisa Sakamoto
 */
/*----------------------------------------------------------------------------
 *
 *  Copyright (c) Visualization Laboratory, Kyoto University.
 *  All rights reserved.
 *  See http://www.viz.media.kyoto-u.ac.jp/kvs/copyright/ for details.
 *
 *  $Id$
 */
/*****************************************************************************/
#include <iostream>
#include <kvs/glut/Application>
#include <kvs/CommandLine>
#include "MainView.h"
#include "OverView.h"
#include "DataSet.h"
#include "ResourceMonitor.h"


int main( int argc, char** argv )
{
    kvs::glut::Application app( argc, argv );
    MainView main_view( &app );
    OverView over_view( &app );

    // Overview screen.
    main_view.attachOverViewScreen( &over_view );

    // Data set.
    std::string filename( argv[1] );
    DataSet data_set( filename );
    main_view.attachDataSet( &data_set );
    over_view.attachDataSet( &data_set );

    // Layout.
    size_t x = main_view.x();
    size_t y = main_view.y();
    size_t w = main_view.width();
    over_view.setPosition( x + w + 10, y );

    // Resource monitor.
    ResourceMonitor resource_monitor;
    main_view.attachResourceMonitor( &resource_monitor );
    over_view.attachResourceMonitor( &resource_monitor );

    // Load initial object.
    main_view.loadObject();
    over_view.loadObject();

    // Run app.
    main_view.show();
    over_view.show();
    return app.run();
}
